import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    login:JSON.parse(localStorage.getItem('login')|| '[]') //从localstorage里拿数据
  },
  mutations: {
    //登陆时调用函数将用户信息存储到localstorage
    showlogin(state, value){
      console.log('======value',value)
      state.login = value
      localStorage.setItem('list',JSON.stringify(state.login))
    }
  },
  actions: {
  },
  modules: {
  }
})
